package Finance::NSCC::Insurance::Schema::Commission;

use strict;
use warnings;

use base 'DBIx::Class';

__PACKAGE__->load_components("Core");
__PACKAGE__->table("commissions");
__PACKAGE__->add_columns(
  "nscc_control_num",
  { data_type => "CHAR", default_value => "", is_nullable => 0, size => 20 },
  "nscc_num",
  { data_type => "CHAR", default_value => "", is_nullable => 0, size => 4 },
  "contract_num",
  { data_type => "VARCHAR", default_value => "", is_nullable => 0, size => 30 },
  "trans_effective_d",
  { data_type => "DATE", default_value => undef, is_nullable => 1, size => 10 },
  "settle_d",
  { data_type => "DATE", default_value => undef, is_nullable => 1, size => 10 },
  "process_d",
  { data_type => "DATE", default_value => undef, is_nullable => 1, size => 10 },
  "prepaid_amt",
  { data_type => "DECIMAL", default_value => "", is_nullable => 0, size => 16 },
  "basis_amt",
  { data_type => "DECIMAL", default_value => "", is_nullable => 0, size => 16 },
  "basis_reason_code",
  { data_type => "VARCHAR", default_value => "", is_nullable => 0, size => 3 },
  "rate",
  {
    data_type => "DECIMAL",
    default_value => undef,
    is_nullable => 1,
    size => 10,
  },
  "total_premium_amt",
  {
    data_type => "DECIMAL",
    default_value => undef,
    is_nullable => 1,
    size => 16,
  },
);
__PACKAGE__->set_primary_key("nscc_control_num");

__PACKAGE__->belongs_to(contract => 'Finance::NSCC::Insurance::Schema::Contract',
                        {
                         'foreign.nscc_num'     => 'self.nscc_num',
                         'foreign.contract_num' => 'self.contract_num',
                        }
                       );

__PACKAGE__->has_many(recipients => 'Finance::NSCC::Insurance::Schema::CommissionRecipient',
                      {'foreign.nscc_control_num' => 'self.nscc_control_num'}
                     );

__PACKAGE__->has_many
  (underlying_assets => 'Finance::NSCC::Insurance::Schema::CommissionUnderlyingAsset',
   {'foreign.nscc_control_num' => 'self.nscc_control_num'}
  );


1;
